<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%@ include file="/include.jsp"%>

<script type="text/javascript">
var menuId = '${menuId}';
$(function() {
	var $orgiframe = $('#orgiframe');
	var $orgtree = $('#orgtree').tree({
	    url: ctx + '/sys/org/list',
	    queryParams: {
	        tree: true,
	        orgTypes: ['company', 'dept', 'post', 'person']
	    },
	    lines: true,
        formatter: function(node) {
            return node.name || node.id;
        },
        loadFilter: function(data) {
            if (data) {
                for (var i in data) {
                    var item = data[i];
                    if ('post' == item.orgType && item.children != null) {
                        item.state = 'closed';
                    }
                    if (item.children) {
                        arguments.callee(item.children);
                    }
                }
            }
            return data;
        },
        onClick: function(node) {
            $orgiframe.attr('src', ctx + '/sys/org/' + node.orgType + '/' + node.id);
        }
	});
	
});

function orgtreeReload() {
    $('#orgtree').tree('reload');
}
</script>

<title>TSWEB</title>
</head>
<body class="easyui-layout" style="margin:5px;">
    <div data-options="region:'west', title:'组织结构', split:true, tools: [{id:'org-refresh', iconCls:'icon-reload', handler:'orgtreeReload'}]"
        style="width:15%;">
        <ul id="orgtree"></ul>
    </div>
    <div data-options="region:'center', title:'组织信息'">
        <!-- <iframe id="orgiframe" scrolling="auto" frameborder="0" style="width:100%; height:100%;"></iframe> -->
        <iframe id="orgiframe" style="width:100%; height:100%; border:0;"></iframe>
    </div>
</body>
</html>